package com.msb.servicemap.service;

import com.msb.commons.response.DirectionResponse;
import com.msb.commons.response.ResponseResult;
import com.msb.servicemap.remote.MapDirectionClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: chshh
 * @version: 1.0
 */
@Service
public class DirectionService {

    @Autowired
    private MapDirectionClient mapDirectionClient;
    /**
     * 根据起点和终点的经纬度获取距离(米)和时长(分钟)
     * @param depLongitude
     * @param depLatitude
     * @param destLongitude
     * @param destLatitude
     * @return
     */
    public ResponseResult driving(String depLongitude, String depLatitude, String destLongitude, String destLatitude){

        //调用第三方地图接口
        DirectionResponse directionResponse = mapDirectionClient.direction(depLongitude, depLatitude, destLongitude, destLatitude);

        return ResponseResult.success(directionResponse);
    }
}
